import Taro from '@tarojs/taro'
import React, { Component } from 'react'
import { View, ScrollView } from '@tarojs/components'
import { SpMessage, SpLoading, SpNote, SpToast } from '@/components'
import { showToast } from '@/utils'
import { connect } from 'react-redux'
import api from '@/api'
import Message from '../message'
import ShopList from '../shop'
import S from '@/spx'
import { AtNavBar } from 'taro-ui'
import index from '@/components/sp-radio'
class TwoIndex extends Component {
    constructor(props) {
        super(props);
    }
    state = {}
    async componentDidMount() {
        console.log('componentDidMount-------')
        S.getLoginType()
        if (!S.getLoginType()) {
          console.log('componentDidMount-------11111')
          await Taro.setTabBarItem({
            index: 0,
            text: '商家',
          })
          await Taro.setTabBarItem({
            index: 1,
            text: '店铺',
            iconPath: './assets/imgs/index/shop.png',
            selectedIconPath: './assets/imgs/index/shopHover.png',
          })
        } else {
          console.log('componentDidMount-------22222')
          await Taro.setTabBarItem({
            index: 0,
            text: '店铺',
          })
          await Taro.setTabBarItem({
            index: 1,
            text: '消息',
            iconPath: './assets/imgs/index/message.svg',
            selectedIconPath: './assets/imgs/index/messageHover.svg',
          })
        }
        if (S.getAuthToken()) {
            
        } else {
          Taro.reLaunch({ url: `/pages/auth/login` })
        }
       
      }
    render() {
        let loginType = S.getLoginType()
        return (
            <>
                {!loginType ? (<ShopList formType='index'></ShopList>):(<Message></Message>)
                }
            </>

        );
    }
}

export default TwoIndex;